<template>
	<view style="width: 100%;height: 100%;">
		<list-scroll @loadmore="loadmore">
			<!-- 里面有一个type属性用来判断点击收藏首页是否要重新渲染数据 -->
			<!-- 加一个view标签是小程序兼容性问题，因为list数组是异步加载的，所以一开始的时候uni-load-more是在上面的 -->
			<view>
				<list-card :type="type" :item="item" v-for="(item, index) in list" :key="index" ></list-card>
			</view>
			<uni-load-more v-if="list.length === 0 || list.length > 4" style="width: 100%;" :status="load.loading || 'loading'" iconType="snow"></uni-load-more>
		</list-scroll>
	</view>
</template>

<script>
	export default {
		name: 'listItem',
		props: {
			list: {
				type: Array,
				default() {
					return []
				}
			},
			load: {
				type: Object,
				default() {
					return {
						page: 1,
						loading: 'loading'
					}
				}
			},
			type: {
				type: String,
				default: ''
			}
		},
		methods: {
			loadmore() {
				this.$emit('loadmore')
			}
		}
	}
</script>

<style>
</style>
